<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Get the details of an entry defined by its name</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="ziparchive.statindex.html">« ZipArchive::statIndex</a></li>
      <li style="float: right;"><a href="ziparchive.unchangeall.html">ZipArchive::unchangeAll »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="class.ziparchive.html">ZipArchive</a></li>
    <li>Get the details of an entry defined by its name</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="ziparchive.statname" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">ZipArchive::statName</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.2.0, PHP 7, PHP 8, PECL zip &gt;= 1.5.0)</p><p class="refpurpose"><span class="refname">ZipArchive::statName</span> &mdash; <span class="dc-title">Get the details of an entry defined by its name</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-ziparchive.statname-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>ZipArchive::statName</strong></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter">$name</code></span>, <span class="methodparam"><span class="type">int</span> <code class="parameter">$flags</code><span class="initializer"> = 0</span></span>): <span class="type"><span class="type">array</span>|<span class="type"><span class="type false">false</span></span></span></div>

  <p class="para rdfs-comment">
    The function obtains information about the entry defined by its
    name.
  </p>
 </div>

 <div class="refsect1 parameters" id="refsect1-ziparchive.statname-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>
    
     <dt>
<code class="parameter">name</code></dt>

     <dd>

      <p class="para">
       Name of the entry
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">flags</code></dt>

     <dd>

      <p class="para">
       The flags argument specifies how the name lookup should be done.
       Also, <strong><code>ZipArchive::FL_UNCHANGED</code></strong> may be ORed to it to request
       information  about  the  original  file  in  the archive,
       ignoring any changes made.
       <ul class="itemizedlist">
        <li class="listitem">
         <p class="para">
          <strong><code>ZipArchive::FL_NOCASE</code></strong>
         </p>
        </li>
        <li class="listitem">
         <p class="para">
          <strong><code>ZipArchive::FL_NODIR</code></strong>
         </p>
        </li>
        <li class="listitem">
         <p class="para">
          <strong><code>ZipArchive::FL_UNCHANGED</code></strong>
         </p>
        </li>
       </ul>
      </p>
     </dd>

    
   </dl>

  </p>
 </div>

 <div class="refsect1 returnvalues" id="refsect1-ziparchive.statname-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   Returns an array containing the entry details  或者在失败时返回 <strong><code>false</code></strong>.
  </p>
 </div>

 <div class="refsect1 examples" id="refsect1-ziparchive.statname-examples">
  <h3 class="title">范例</h3>
    <div class="example" id="example-873">
     <p><strong>示例 #1 Dump the stat info of an entry</strong></p>
     <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$zip&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">ZipArchive</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$res&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$zip</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">open</span><span style="color: #007700">(</span><span style="color: #DD0000">'test.zip'</span><span style="color: #007700">);<br />if&nbsp;(</span><span style="color: #0000BB">$res&nbsp;</span><span style="color: #007700">===&nbsp;</span><span style="color: #0000BB">TRUE</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">print_r</span><span style="color: #007700">(</span><span style="color: #0000BB">$zip</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">statName</span><span style="color: #007700">(</span><span style="color: #DD0000">'foobar/baz'</span><span style="color: #007700">));<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$zip</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">close</span><span style="color: #007700">();<br />}&nbsp;else&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">'failed,&nbsp;code:'&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">$res</span><span style="color: #007700">;<br />}<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
     </div>

      <div class="example-contents"><p>以上例程的输出类似于：</p></div>
     <div class="example-contents screen">
<div class="cdata"><pre>
Array
(
    [name] =&gt; foobar/baz
    [index] =&gt; 3
    [crc] =&gt; 499465816
    [size] =&gt; 27
    [mtime] =&gt; 1123164748
    [comp_size] =&gt; 24
    [comp_method] =&gt; 8
)
</pre></div>
     </div>

    </div>

   </div>

</div></div></div></body></html>